﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Xml.Serialization;

namespace fbasync
{
    [DataContract, Serializable]
    public class NewsItem
    {
        [DataMember(Name = "image"), XmlElement("image")]
        public string Image { get; set; }

        [DataMember(Name = "news"), XmlElement("news")]
        public List<News> News { get; set; }
    }

    [DataContract, Serializable]
    public class News
    {
        [DataMember(Name = "message"), XmlElement("message")]
        public string Message { get; set; }

        [DataMember(Name = "action_link"), XmlElement("action_link")]
        public ActionLink Action_Link { get; set; }

        public virtual string ToJson()
        {
            var dict = new Dictionary<string, string>(2);
            dict.Add("message", Message);
            if (Action_Link != null)
                dict.Add("action_link", Action_Link.ToJson());
            return dict.ToJsonAssociativeArray();
        }
    }
}
